from email.policy import default

import streamlit as st

import pandas as pd  # 处理数据
import numpy as np   # 处理数据

# pip  install pandas,numpy -i pip的清华源

st.title("汪恺明交互式输入控件")

st.header("基础输入控件")

# 文本输入
name = st.text_input("你的姓名",placeholder="请输入你的姓名")
email = st.text_input("你的邮箱",placeholder="请输入你的邮箱")

# 数字输入

age = st.number_input("年龄",min_value=0,max_value=120,value=18)

height = st.slider("身高",100,230,175)


# 日期

birth_date = st.date_input("出生日期")

st.time_input("预约的时间")




# 单选和多选
gender =st.radio("性别",options=["男","女","其他"])

selected = st.multiselect(
    "请选择您的兴趣爱好",
    options=["游戏", "读书", "学习", "代码", "运动", "音乐"],
    default=["读书", "音乐"]
)

st.write("您选择的兴趣:", selected)


st.selectbox("所在城市",["北京","上海","杭州","深圳","安庆"])
st.select_slider("最高学历",options=["高中","专科","本科","研究生","博士"])


# 颜色选择

color = st.color_picker("选择你喜欢的颜色","#00ff44")

st.write(f"选中的颜色",{color})


# 按钮
if st.button("提交信息"):
    if name and email:
        st.success("信息提交成功！！")
        st.json({
            "姓名":name,
            "邮箱": email,
            "年龄": age,
            "性别": gender,
            "喜欢的颜色":color

        })
    else:
        st.error("请 填写你的邮箱或姓名")
